#pragma once
#include "res.h"
#include "basewindow.h"
#include "note.h"
#include "datalist.h"
#include "bmpbutton.h"
#include "centerwindow.h"
#define MYWM_NOTIFYICON		WM_USER + 1000
#define IDMI_ADDNOTE	WM_USER + 1001
#define IDMI_OPTIONS	WM_USER + 1002
#define IDMI_MAINWIN	WM_USER + 1003
#define IDMI_TOPMOST	WM_USER + 1004
#define IDMI_SAVEALL	WM_USER + 1005

class CMainWindow :
	public CBaseWindow
{
public:
	CMainWindow(void);
	~CMainWindow(void);
	BOOL CreateEx(
			DWORD dwExStyle,
			LPCTSTR lpszClass, LPCTSTR lpszName, DWORD dwStyle,
			int nX, int nY, int cx, int cy,
			HWND hParent,
			HMENU hMenu,
			HINSTANCE hInst
		);

private:
	CppSQLite3DB db;
	NOTIFYICONDATA m_tnd;
	HMENU m_hMenu;

	CNoteMgr *m_noteMgr;
	CDataList m_datalist;
	CCenterWindow *m_center;

	LRESULT WndProcExt(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	int OnCommandExt(HWND hWnd, WORD wID, WORD wNotifyCode);
	LRESULT OnTrayIconMsg(UINT uMsg);
	void OnClose();
	void OnPaint(HDC dc);

	void SaveAll();
	BOOL topmost;
	void ToggleTopmost();

	CBmpButton tabs[4];
};
